﻿using AuthCenter.Api.Read.Application.Command.Menu;
using AuthCenter.Api.Read.Application.Output;
using AuthCenter.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace AuthCenter.Api.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class MenuController : ControllerBase
    {
        private readonly IMediator mediator;
        public MenuController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取菜单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<MenuOutput>>> GetMenuShow([FromQuery]GetMenuShowCommand request) 
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取父级菜单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<PersonOutput>>> GetShow([FromQuery] GetShowCommand request) 
        {
            return mediator.Send(request);
        }
    }
}
